#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QCamera>
#include <QCameraViewfinder>
#include <QCameraImageCapture>
#include <QCameraInfo>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QMediaRecorder>
#include <QUrl>
#include <QMediaMetaData>
#include <QDir>
#include <QVideoWidget>
#include <QWindow>
#include <QTimer>
#include <QPainter>
#include <QPaintEvent>

#include "abstractvideosurface.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    QCamera *camera;//定义摄像头指针对象
    QCameraViewfinder *viewfind;//定义取景器指针对象
    QList<QCameraInfo> cameras;//定义可用摄像头序列信息列表
    QCameraImageCapture *imageCapture;//定义摄像头当前帧

    QLabel *display_label;
    QPushButton *capture_button;
    QPushButton *save_button;
    QPushButton *exit_button;
    QCameraImageCapture *camera_image_capture;

    QMediaRecorder *mMediaRecorder;
    void bindRecoder(QCamera *camera);

    QPixmap pix;
    void paintEvent(QPaintEvent *event)override;
public slots:
    void translateLanguage();
    void displayImage(int id, QImage image);
    void captureImage();
    void saveImage();

    void rcvImage(QImage image);
private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
